package model

import "gorm.io/gorm"

type MarketCity struct {
	gorm.Model
	Province    string   `form:"province" json:"province"`
	City        string   `form:"city" json:"city"`
	Area        string   `form:"area" json:"area"`
	Description string   `form:"description" json:"description"`
	Market      []Market `gorm:"ForeignKey:CityId;AssociationForeignKey:Id" json:"marketList,omitempty"`
}

type MarketCityTree struct {
	Province   string     `form:"province" json:"province"`
	CityNumber int        `form:"cityNumber" json:"cityNumber"`
	City       []CityNode `form:"cityList" json:"cityList"`
}

type CityNode struct {
	City         string       `form:"city" json:"city"`
	MarketNumber int          `form:"marketNumber" json:"marketNumber"`
	Market       []MarketNode `form:"marketList" json:"marketList"`
}

type MarketNode struct {
	MarketId       uint   `form:"marketId" json:"marketId"`
	Market         string `form:"market" json:"market"`
	CustomerNumber int    `form:"customerNumber" json:"customerNumber"`
}

type Market struct {
	gorm.Model
	UserId         int              `form:"userId" json:"userId"`
	MarketCityId   int              `form:"marketCityId" json:"marketCityId"`
	Province       string           `form:"province" json:"province"`
	City           string           `form:"city" json:"city"`
	Area           string           `form:"area" json:"area"`
	Market         string           `form:"market" json:"market"`
	Position       string           `form:"position" json:"position"`
	Description    string           `form:"description" json:"description"`
	MarketCustomer []MarketCustomer `gorm:"ForeignKey:MarketId;AssociationForeignKey:Id" json:"customerList,omitempty"`
}

type MarketCustomer struct {
	gorm.Model
	UserId       int    `gorm:"userId" json:"userId"`
	MarketCityId int    `form:"marketCityId" json:"marketCityId"`
	MarketId     int    `form:"marketId" json:"marketId"`
	Province     string `form:"province" json:"province"`
	City         string `form:"city" json:"city"`
	Area         string `form:"area" json:"area"`
	Date         string `form:"date" json:"date"`
	Market       string `form:"market" json:"market"`
	Shop         string `form:"shop" json:"shop"`
	ShopNumber   string `form:"shopNumber" json:"shopNumber"`
	Level        string `form:"level" json:"level"`
	Customer     string `form:"customer" json:"customer"`
	Phone        string `form:"phone" json:"phone"`
	PhoneOne     string `form:"phoneOne" json:"phoneOne"`
	Product      string `form:"product" json:"product"`
	Remark       string `form:"remark" json:"remark"`
	Attribute    string `form:"attribute" json:"attribute"`
}
